package com.warehouse.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @authoor Bilysen
 * @date 2021/4/23 - 22:17
 **/
public class DateUtilss {

        public static int getDaysOfMonth(Date date) {
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
        }

        public static void main(String[] args) throws ParseException {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
            System.out.println(getDaysOfMonth(sdf.parse("2018-4")));
        }

    }
